package com.blueocean_health.care.management.mapper;

import com.blueocean_health.care.management.domain.base.NurseCheckWork;
import com.blueocean_health.care.management.util.MyMapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface NurseCheckWorkMapper extends MyMapper<NurseCheckWork> {

    @Select("SELECT " +
            "* " +
            "FROM " +
            "nurse_check_work a " +
            "WHERE a.`deflag` = 0 " +
            "AND a.`work_time` >=#{startTime} " +
            "AND a.`work_time` <=#{endTime} " +
            "AND a.`work_status` = 0 ")
    List<NurseCheckWork> queryAllByStartAndEndTime(@Param("startTime")String startTime,@Param("endTime")String endTime);
    
    @Select("SELECT " +
    		"count(1) " +
    		"FROM " +
    		"nurse_check_work a " +
    		"WHERE a.`deflag` = 0 " +
    		"AND a.`work_time` >=#{startTime} " +
    		"AND a.`work_time` <=#{endTime} " +
    		"AND a.`work_status` = 0 AND work_id = #{workId} AND group_id = #{groupId}")
    Integer queryByWorkIdAndGroupId(@Param("workId")String workId,@Param("groupId")String groupId,@Param("startTime")String startTime,@Param("endTime")String endTime);


}